﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using fideeraSoft.Utils;
using fideeraSoft.Handlers;
using fideeraSoft.Forms;
using fideeraSoft.Entities;

namespace fideeraSoft
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!SQLclass.tryToConnectToSQL())
            {
                MessageBox.Show("Error al conectar DB\n", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);

                Application.Exit();
            }
            else
            {
                Handler handler = new Handler();

                
                FormLogeoUsuario formLogin = new FormLogeoUsuario(handler);

                //MessageBox.Show("PASE DB\n", "DEBUG", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (formLogin.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {

                 //   MessageBox.Show("Dialog ok");      //DEBUG
                    Application.Run(new FideeraForm(handler));
                }
                else
                {
                    Application.Exit();
                  //  MessageBox.Show("Dialog no ok");      //DEBUG
                }

                
                

            }
        }
    }
}
